package cn.gxufe.reliable.message.api.common;

import cn.gxufe.reliable.message.common.Message;
import cn.gxufe.reliable.message.common.ResultVo;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * @author yingjie.rong
 **/
public interface RMSApi {
    /**
     * prepare
     * @param message
     * @return
     */
    @RequestMapping(value = "/message/prepare",method = RequestMethod.PUT)
    @Transactional(rollbackFor = Throwable.class,propagation = Propagation.MANDATORY)
    ResultVo prepare(@RequestBody Message message);
    /**
     * finish
     * @param message
     * @return
     */
    @RequestMapping(value = "/message/finish",method = RequestMethod.POST )
    ResultVo finish(@RequestBody Message message);

    /**
     * cancel
     * @param message
     * @return
     */
    @RequestMapping(value = "/message/cancel",method = RequestMethod.POST)
    ResultVo cancel(@RequestBody Message message);
}
